home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kmdichildfrmcaption.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.9 KB  |  146 lines

  1. //----------------------------------------------------------------------------
  2. //    filename             : kmdichildfrmcaption.h
  3. //----------------------------------------------------------------------------
  4. //    Project              : KDE MDI extension
  5. //
  6. //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
  7. //                                         (an IRC application)
  8. //    changes              : 09/1999       by Falk Brettschneider to create an
  9. //                           - 06/2000     stand-alone Qt extension set of
  10. //                                         classes and a Qt-based library
  11. //                           2000-2003     maintained by the KDevelop project
  12. //
  13. //    copyright            : (C) 1999-2003 by Falk Brettschneider
  14. //                                         and
  15. //                                         Szymon Stefanek (stefanek@tin.it)
  16. //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
  17. //----------------------------------------------------------------------------
  18. //
  19. //----------------------------------------------------------------------------
  20. //
  21. //    This program is free software; you can redistribute it and/or modify
  22. //    it under the terms of the GNU Library General Public License as
  23. //    published by the Free Software Foundation; either version 2 of the
  24. //    License, or (at your option) any later version.
  25. //
  26. //----------------------------------------------------------------------------
  27. #ifndef _KMDI_CHILD_FRM_CAPTION_H_
  28. #define _KMDI_CHILD_FRM_CAPTION_H_
  29.  
  30. #include <qwidget.h>
  31.  
  32. #include "kmdidefines.h"
  33.  
  34. class KMdiChildFrm;
  35.  
  36.  
  37. class KMdiChildFrmCaptionPrivate;
  38.  
  39. /**
  40. * @short Internal class.
  41. *
  42. * It's the caption bar of a child frame widget.
  43. */
  44. class KMDI_EXPORT KMdiChildFrmCaption : public QWidget
  45. {
  46.     Q_OBJECT
  47. public:
  48.     /**
  49.      * Constructor
  50.      */
  51.     KMdiChildFrmCaption( KMdiChildFrm *parent );
  52.  
  53.     /**
  54.      * Destructor
  55.      */
  56.     ~KMdiChildFrmCaption();
  57.  
  58.     /**
  59.      * Repaint the caption bar in active background colors
  60.      */
  61.     void setActive( bool bActive );
  62.  
  63.     /**
  64.      * Repaint with a new caption bar title
  65.      */
  66.     void setCaption( const QString& text );
  67.  
  68.     /**
  69.      * Returns the caption bar height depending on the used font
  70.      */
  71.     int heightHint();
  72.  
  73. public slots:
  74.     /**
  75.      * Grabs the mouse, a move cursor, sets a move indicator variable to true and keeps the global mouse position in mind
  76.      */
  77.     void slot_moveViaSystemMenu();
  78.  
  79. protected:
  80.     /**
  81.      * Draws the caption bar and its title using the settings
  82.      */
  83.     virtual void paintEvent( QPaintEvent *e );
  84.  
  85.     /**
  86.      * The same as KMdiChildFrmCaption::slot_moveViaSystemMenu
  87.      */
  88.     virtual void mousePressEvent( QMouseEvent * );
  89.  
  90.     /**
  91.      * Calls maximizePressed of the parent widget ( KMdiChildFrm )
  92.      */
  93.     virtual void mouseDoubleClickEvent( QMouseEvent * );
  94.  
  95.     /**
  96.      * Restore the normal mouse cursor, set the state variable back to 'not moving'
  97.      */
  98.     virtual void mouseReleaseEvent( QMouseEvent * );
  99.  
  100.     /**
  101.      * Checks if out of move range of the KMdiChildArea and calls KMdiChildFrm::move
  102.      */
  103.     virtual void mouseMoveEvent( QMouseEvent *e );
  104.  
  105.     /**
  106.      * Computes a new abbreviated string from a given string depending on a given maximum width
  107.      * @todo Replace with a call to a KStringHandler function instead of rolling our own
  108.      */
  109.     QString abbreviateText( QString origStr, int maxWidth );
  110.  
  111.     // attributes
  112. public:
  113.     /**
  114.      * the title string shown in the caption bar
  115.      */
  116.     QString m_szCaption;
  117.  
  118. protected:  // Protected attributes
  119.     /**
  120.      * parent widget
  121.      */
  122.     KMdiChildFrm *m_pParent;
  123.  
  124.     /**
  125.      * state variable indicating whether activated or not activated
  126.      */
  127.     bool m_bActive;
  128.  
  129.     /**
  130.      * the position offset related to its parent widget (internally used for translating mouse move positions
  131.      */
  132.     QPoint m_offset;
  133.  
  134.     /**
  135.      * True if the child knows that it is currently being dragged.
  136.      */
  137.     bool m_bChildInDrag;
  138.  
  139. private:
  140.     KMdiChildFrmCaptionPrivate *d;
  141. };
  142.  
  143. #endif //_KMDICAPTION_H_
  144.  
  145. // kate: space-indent off; replace-tabs off; indent-mode csands; tab-width 4;
  146.